package com.talent.model.convertor;


import com.talent.model.dto.SysRoleDto;
import com.talent.model.entity.sys.SysRole;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.factory.Mappers;

@Mapper
public interface RoleConvertor {

    RoleConvertor INSTANCE = Mappers.getMapper( RoleConvertor.class );


    /**
     * 将dto转成po
     * @param dto
     * @return
     */

    SysRole dtoToPo(SysRoleDto dto);


    /**
     *
     * @param dto 更新
     * @param role
     * @return  更新后
     */
    @Mapping(target = "id",source = "id")
    @Mapping(target = "name",source = "name")
    @Mapping(target = "code",source = "code")
    @Mapping(target = "description",source = "description")
    SysRole update(SysRoleDto dto,@MappingTarget  SysRole role);


}
